Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Anthropic extended thinking #2315

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apappascs
Copy link
Contributor

@apappascs apappascs commented Feb 25, 2025

  • The thinking option is added to AnthropicChatOptions and ChatCompletionRequest.
  • The AnthropicApi and AnthropicChatModel now handle THINKING and REDACTED_THINKING content blocks in responses. New tests verify parsing of these blocks.
  • Updated method signatures on ChatCompletionRequestBuilder, deprecating old builders with with* prefix in favor of those without.

more details:

Local testing:

./mvnw spring-javaformat:apply
./mvnw clean install -DskipTests -Dmaven.javadoc.skip=true
./mvnw verify -Pintegration-tests -pl models/spring-ai-anthropic

@apappascs apappascs force-pushed the feature/anthropic-thinking branch 4 times, most recently from 7d387cf to 9168278 Compare February 27, 2025 21:15
@apappascs apappascs changed the title feat: Enhance Anthropic integration with Thinking feat: Anthropic extended thinking Feb 27, 2025
break;
case THINKING, THINKING_DELTA:
System.out.println(
"THINKINGTHINKINGTHINKINGTHINKINGTHINKINGTHINKINGTHINKINGcontent type: " + content.type());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apappascs Debug code remains

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @birariro just removed it

- The `thinking` option is added to `AnthropicChatOptions` and `ChatCompletionRequest`.
- The `AnthropicApi` and `AnthropicChatModel` now handle `THINKING` and `REDACTED_THINKING` content blocks in responses.  New tests verify parsing of these blocks.
- Updated method signatures on ChatCompletionRequestBuilder, deprecating old builders with `with*` prefix in favor of those without.

Signed-off-by: Alexandros Pappas <[email protected]>
@apappascs apappascs force-pushed the feature/anthropic-thinking branch from 9168278 to 06c0a1a Compare February 28, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants